//
//  XinYongHuViewController.m
//  fuxi
//
//  Created by 钟纪旺 on 17/2/27.
//  Copyright © 2017年 zjw. All rights reserved.
//

#import "XinYongHuViewController.h"
#import "LoginData.h"
#import "ObtainData.h"
#import "Network.h"
#import "DengLu.h"
@interface XinYongHuViewController ()
@property (weak, nonatomic) IBOutlet UITextField *name;
@property (weak, nonatomic) IBOutlet UITextField *password;
@property (weak, nonatomic) IBOutlet UITextField *department;

@end

@implementation XinYongHuViewController
- (IBAction)registered:(id)sender {
    [Network loginWithName:self.name.text password:self.password.text tel:self.department.text  complete:^(LoginData *  d){
        LoginData *ata = d;
        
        // GCD 大中枢派发
        dispatch_async(dispatch_get_main_queue(), ^{
            // 刷新界面代码
            
            HUD = [[MBProgressHUD alloc] initWithView:self.view];
            [self.view addSubview:HUD];
            HUD.labelText =@"恭喜您注册成功!";
            HUD.mode = MBProgressHUDModeText;
            [HUD showAnimated:YES whileExecutingBlock:^{
                sleep(2);
            }completionBlock:^{
                [HUD removeFromSuperview];
                HUD =nil;
                DengLu *con = [self.storyboard instantiateViewControllerWithIdentifier:@"dddd"];
                //推进去
                [self presentViewController:con animated:YES completion:^{
                    
                }];
                
            }];
            
            
        });
    }];
    

    
    
    
    
    
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
